package p270jp.pxv.android.advertisement.presentation.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.socdm.p087d.adgeneration.ADG;
import java.util.Objects;
import p062c4.ViewBindings;
import p064c6.Preconditions;
import p072ce.ViewNovelAdContainerBinding;
import p155fe.YufulightRequestParameterBuilder;
import p189gn.AbstractC3435a;
import p189gn.AbstractC3446l;
import p216hn.Lambda;
import p216hn.Reflection;
import p233ie.AdSwitchActionCreator;
import p233ie.AdSwitchStore;
import p270jp.pxv.android.R;
import p270jp.pxv.android.legacy.model.GoogleNg;
import p312le.MangaGridADGView;
import p312le.MangaGridAdSwitchView;
import p325m0.MutabilityOwnership;
import p350mp.Timber;
import p376no.Koin;
import p404oo.AbstractC5475a;
import p467rd.subscribers;
import p493sf.C6044d;
import p572vg.RotationInterval;
import p572vg.YufulightAdvertisement;
import p579vo.Qualifier;
import p579vo.StringQualifier;
import p603wm.AbstractC6949c;
import p603wm.Unit;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p671zc.Disposable;

/* compiled from: NovelNativeAdSwitchView.kt */
/* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView */
/* loaded from: classes2.dex */
public final class NovelNativeAdSwitchView extends FrameLayout implements AbstractC5475a {

    /* renamed from: f */
    public static final /* synthetic */ int f18826f;

    /* renamed from: a */
    public final C6044d f18827a = new C6044d(null, 1);

    /* renamed from: b */
    public final AbstractC6949c f18828b = Preconditions.m9802P(1, new C4173d(this, null, null));

    /* renamed from: c */
    public final AbstractC6949c f18829c = Preconditions.m9802P(1, new C4174e(this, new StringQualifier("advertisement_module_ad_switch_action_creator_for_novel_native"), new p312le.NovelNativeAdSwitchView(this, 0)));

    /* renamed from: d */
    public final AbstractC6949c f18830d = Preconditions.m9802P(1, new C4175f(this, null, new MangaGridAdSwitchView(this, 1)));

    /* renamed from: e */
    public final AbstractC6949c f18831e = Preconditions.m9801Q(new MangaGridADGView(this, 1));

    /* compiled from: NovelNativeAdSwitchView.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$a */
    /* loaded from: classes2.dex */
    public static final class C4170a extends Lambda implements AbstractC3446l<YufulightAdvertisement, Unit> {
        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4170a() {
            super(1);
            NovelNativeAdSwitchView.this = r1;
        }

        @Override // p189gn.AbstractC3446l
        public Unit invoke(YufulightAdvertisement eVar) {
            YufulightAdvertisement eVar2 = eVar;
            Timber.f23100a.mo3528a("next", new Object[0]);
            NovelNativeAdSwitchView.m4655b(NovelNativeAdSwitchView.this);
            NovelNativeAdSwitchView novelNativeAdSwitchView = NovelNativeAdSwitchView.this;
            MutabilityOwnership.m3746l(eVar2, "it");
            NovelNativeAdSwitchView.m4654c(novelNativeAdSwitchView, eVar2);
            return Unit.f29503a;
        }
    }

    /* compiled from: NovelNativeAdSwitchView.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$b */
    /* loaded from: classes2.dex */
    public static final class C4171b extends Lambda implements AbstractC3446l<GoogleNg, Unit> {
        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4171b() {
            super(1);
            NovelNativeAdSwitchView.this = r1;
        }

        @Override // p189gn.AbstractC3446l
        public Unit invoke(GoogleNg googleNg) {
            GoogleNg googleNg2 = googleNg;
            MutabilityOwnership.m3745m(googleNg2, "it");
            Timber.f23100a.mo3528a("loadAd", new Object[0]);
            AdSwitchActionCreator actionCreator = NovelNativeAdSwitchView.this.getActionCreator();
            int i = NovelNativeAdSwitchView.f18826f;
            YufulightRequestParameterBuilder.EnumC3104a aVar = YufulightRequestParameterBuilder.EnumC3104a.NOVEL_NATIVE;
            String string = NovelNativeAdSwitchView.this.getContext().getString(R.string.yufulight_language_setting);
            MutabilityOwnership.m3746l(string, "this.context.getString(j…fulight_language_setting)");
            actionCreator.m5152b(googleNg2, aVar, string);
            return Unit.f29503a;
        }
    }

    /* compiled from: NovelNativeAdSwitchView.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$c */
    /* loaded from: classes2.dex */
    public static final class C4172c extends Lambda implements AbstractC3446l<RotationInterval, Unit> {
        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4172c() {
            super(1);
            NovelNativeAdSwitchView.this = r1;
        }

        @Override // p189gn.AbstractC3446l
        public Unit invoke(RotationInterval cVar) {
            RotationInterval cVar2 = cVar;
            MutabilityOwnership.m3745m(cVar2, "it");
            NovelNativeAdSwitchView.this.getActionCreator().m5151c(cVar2);
            return Unit.f29503a;
        }
    }

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$d */
    /* loaded from: classes2.dex */
    public static final class C4173d extends Lambda implements AbstractC3435a<CompositeDisposable> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f18835a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4173d(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f18835a = aVar;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [zc.a, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final CompositeDisposable invoke() {
            return this.f18835a.getKoin().f24118a.m920a().m621a(Reflection.m5499a(CompositeDisposable.class), null, null);
        }
    }

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$e */
    /* loaded from: classes2.dex */
    public static final class C4174e extends Lambda implements AbstractC3435a<AdSwitchActionCreator> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f18836a;

        /* renamed from: b */
        public final /* synthetic */ Qualifier f18837b;

        /* renamed from: c */
        public final /* synthetic */ AbstractC3435a f18838c;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4174e(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f18836a = aVar;
            this.f18837b = aVar2;
            this.f18838c = aVar3;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [ie.b, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final AdSwitchActionCreator invoke() {
            Koin koin = this.f18836a.getKoin();
            return koin.f24118a.m920a().m621a(Reflection.m5499a(AdSwitchActionCreator.class), this.f18837b, this.f18838c);
        }
    }

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.NovelNativeAdSwitchView$f */
    /* loaded from: classes2.dex */
    public static final class C4175f extends Lambda implements AbstractC3435a<AdSwitchStore> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f18839a;

        /* renamed from: b */
        public final /* synthetic */ AbstractC3435a f18840b;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4175f(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f18839a = aVar;
            this.f18840b = aVar3;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [ie.c, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final AdSwitchStore invoke() {
            Koin koin = this.f18839a.getKoin();
            return koin.f24118a.m920a().m621a(Reflection.m5499a(AdSwitchStore.class), null, this.f18840b);
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public NovelNativeAdSwitchView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        MutabilityOwnership.m3745m(context, "context");
        MutabilityOwnership.m3745m(attributeSet, "attributeSet");
    }

    /* renamed from: b */
    public static final void m4655b(NovelNativeAdSwitchView novelNativeAdSwitchView) {
        ADG adg = novelNativeAdSwitchView.getBinding().f5411b.f18818b;
        if (adg != null) {
            adg.pause();
        }
    }

    /* renamed from: c */
    public static final void m4654c(NovelNativeAdSwitchView novelNativeAdSwitchView, YufulightAdvertisement eVar) {
        Objects.requireNonNull(novelNativeAdSwitchView);
        if (eVar instanceof YufulightAdvertisement.C6841a) {
            novelNativeAdSwitchView.getBinding().f5411b.setVisibility(0);
            novelNativeAdSwitchView.getBinding().f5411b.setup(((YufulightAdvertisement.C6841a) eVar).f29129a);
            novelNativeAdSwitchView.getBinding().f5411b.m4657a();
            return;
        }
        novelNativeAdSwitchView.getBinding().f5411b.setVisibility(8);
    }

    public final AdSwitchActionCreator getActionCreator() {
        return (AdSwitchActionCreator) this.f18829c.getValue();
    }

    private final ViewNovelAdContainerBinding getBinding() {
        return (ViewNovelAdContainerBinding) this.f18831e.getValue();
    }

    private final CompositeDisposable getDisposables() {
        return (CompositeDisposable) this.f18828b.getValue();
    }

    private final AdSwitchStore getStore() {
        return (AdSwitchStore) this.f18830d.getValue();
    }

    /* renamed from: d */
    public void m4653d() {
        getActionCreator().m5153a();
    }

    /* renamed from: e */
    public void m4652e() {
        getActionCreator().m5153a();
        getStore().f17464a.m80f();
        getDisposables().m80f();
        ADG adg = getBinding().f5411b.f18818b;
        if (adg != null) {
            ViewBindings.m9831f(adg);
        }
    }

    /* renamed from: f */
    public void m4651f() {
        getActionCreator().m5149e();
    }

    /* renamed from: g */
    public final void m4650g() {
        Disposable g = subscribers.m2589g(getStore().f17473j.m986o(AndroidSchedulers.m334a()), null, null, new C4170a(), 3);
        CompositeDisposable disposables = getDisposables();
        MutabilityOwnership.m3744n(disposables, "compositeDisposable");
        disposables.mo82c(g);
        Disposable g2 = subscribers.m2589g(getStore().f17474k, null, null, new C4171b(), 3);
        CompositeDisposable disposables2 = getDisposables();
        MutabilityOwnership.m3744n(disposables2, "compositeDisposable");
        disposables2.mo82c(g2);
        Disposable g3 = subscribers.m2589g(getStore().f17475l, null, null, new C4172c(), 3);
        CompositeDisposable disposables3 = getDisposables();
        MutabilityOwnership.m3744n(disposables3, "compositeDisposable");
        disposables3.mo82c(g3);
    }

    @Override // p404oo.AbstractC5475a
    public Koin getKoin() {
        return AbstractC5475a.C5476a.m3211a(this);
    }

    public void setGoogleNg(GoogleNg googleNg) {
        MutabilityOwnership.m3745m(googleNg, "googleNg");
        getActionCreator().m5150d(googleNg);
    }
}
